

import Foundation


public class ELog {
    static let LOG_TAG = "Leao"
    static var DEBUG = true
    static var mlog: Ilog?
    
    static func setLog(_ log: Ilog) {
        ELog.mlog = log
    }
    
    public static func d(_ function: String, _ log: String, _ line:Int) {
        if DEBUG,  let _ = mlog {
            d(LOG_TAG, function, log, line)
        }
    }
    
    public static func d(_ tag: String, _ function: String, _ log: String, _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.d(tag, function, log, line)
        }
    }
    
    public static func d(_ tag: String, _ function: String, _ log: String, _ e: Error , _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.d(tag, function, log, e, line)
        }
    }
    
    public static func e(_ function: String, _ log: String , _ line:Int) {
        if DEBUG, let _ = mlog {
            e(LOG_TAG, function, log, line)
        }
    }
    
    public static func e(_ function: String, _ tag: String, _ log: String , _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.e(tag, function, log, line)
        }
    }
    
    public static func e(_ tag: String, _ function: String, _ log: String, _ e: Error , _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.e(tag, function,log, e, line)
        }
    }
    
    public static func i(_ function: String, _ log: String , _ line:Int) {
        if DEBUG, let _ = mlog {
            i(LOG_TAG, function,log, line)
        }
    }
    
    public static func i(_ tag: String, _ function: String, _ log: String , _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.i(tag, function, log, line)
        }
    }
    
    public static func i(_ tag: String, _ function: String, _ log: String, _ e: Error? , _ line:Int) {
        if DEBUG, let mlog = mlog {
            _ = mlog.i(tag, function,log, e, line)
        }
    }
}


